function e(e) {
    return e && e.__esModule ? e : {
        default: e
    };
}

Object.defineProperty(exports, "__esModule", {
    value: !0
});

var t = e(require("../../utils/api2")), a = e(require("../editor/section-image/layout-picker/layout-picker"));

exports.default = {
    addTo: function(e, t) {
        Object.assign(e, a.default, {
            $$imageManagerEdit: function(e, a, n, i) {
                this.$$imageManagerData = e, this.$route("/pages/editor/image-manager/image-manager?sid=" + t.sid + "&model=" + a + "&modid=" + n + "&key=" + i);
            },
            $$imageManagerOnChange: function(e) {
                console.log("image manager change", e);
            }
        });
    },
    uploadImage: function() {
        var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [];
        return e.length ? (wx.showLoading({
            title: "上传图片中..."
        }), Promise.all(e.map(function(e) {
            return t.default.site.attachment.upload({
                data: {
                    file: e,
                    recordid: ""
                },
                upload: "file",
                complete: wx.hideLoading
            });
        })).then(function(e) {
            var t = [];
            return e.forEach(function(e) {
                var a = e.fieldid, n = e.url;
                t.push({
                    fieldid: a,
                    url: n,
                    desc: "",
                    link: null
                });
            }), e.length !== t.length ? new Promise(function(a) {
                wx.showModal({
                    content: e.length - t.length + "上传失败",
                    showCancel: !1,
                    success: function() {
                        a(t);
                    }
                });
            }) : t;
        })) : Promise.reject("文件路径错误");
    }
};